package com.gupao.coupon.portal.couponportal.controller;

import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.rpc.service.GenericService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;
import java.util.logging.Handler;

/**
 * @Author: Mic
 * @公众号： 跟着Mic学架构
 * @官网： https://ke.gupaoedu.cn
 * @Org: 咕泡教育
 **/

@RestController
public class GenericController {

    @DubboReference(interfaceName = "org.gupao.normal.user.IUserService")
    GenericService genericService;

    @GetMapping("/generic")
    public String generic(){
        Map<String,Object> person=new HashMap<>();
        person.put("name","Mic");
        person.put("age",18);
        Object result=genericService.$invoke(
                "savePerson",
                new String[]{"org.gupao.normal.user.Person"},
                new Object[]{person});
        return result.toString();
    }
}
